<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ page  isELIgnored="false"%> 
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html>
<html>
	<head>
    <base href="<%=basePath%>">
    
    <title></title>
    
	<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
	<meta name="viewport" content="width=device-width,height=device-height,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
	<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/css/bootstrap.min.css" />
    <link href="<%=request.getContextPath()%>/assets/css/font-awesome.css" rel="stylesheet" />
    <link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css' />
    <script src="assets/js/jquery-1.10.2.js"></script>
	<script  type="text/javascript" src="<%=request.getContextPath()%>/js/bootstrap.min.js" ></script>
	
	<link href="assets/css/bootstrap-fileupload.min.css" rel="stylesheet" />
	<link href="assets/css/custom.css" rel="stylesheet" />
	<link href="assets/css/basic.css" rel="stylesheet" />
	<link rel="stylesheet" href="css/Orderfont.css"><link>
	</head>
    <body>
               <div class="panel panel-info">
                        <div class="page-header">
		  		<h1><small>添加医生<i class="icon-double-angle-right"></i></small></h1>
			</div>
                        <div class="panel-body">
                            <form method="post" role="form" action="doctorManagement/addDoctorPost" class="form-horizontal" enctype="multipart/form-data">
                                        <%--姓名 --%>
	                                     <div class="form-group">
	                                          <label for="name" class="control-label col-sm-3">姓名</label>
	                                          <div class="col-sm-6">
	                                          	<input class="form-control" type="text" name="name" id="name"> 
	                                          </div>
	                                      </div>
                                 		
                                        <%--电话 --%>
	                                     <div class="form-group">
	                                          <label for="phone" class="control-label col-sm-3">电话</label>
	                                          <div class="col-sm-6">
	                                          	<input class="form-control" type="text" name="phone" id="phone"> 
	                                          </div>
	                                      </div>                                        
                                           
                                        <%--身份证号 --%>
                                 		<div class="form-group">
	                                          <label for="identification" class="control-label col-sm-3">身份证号码</label>
	                                          <div class="col-sm-6">
	                                          	<input class="form-control" type="text" name="identificationNumber" id="identification"> 
	                                          </div>
                                        </div>  
                                        <%--学历 --%>
                                 		<div class="form-group">
                                            <label for="degree" class="control-label col-sm-3">学历</label>
                                            <div class="col-sm-6">
                                            <select class="form-control"  name="degree" id="degree">
                                            	<option>专科</option>
                                            	<option>本科</option>
                                            	<option>硕士</option>
                                            	<option selected="selected">博士</option>
                                            </select>
                                            </div>
                                        </div>
                                        <%--医生标签 --%>
                                 		<div class="form-group">
                                            <label for="degree" class="control-label col-sm-3">医生标签</label>
                                            <div class="col-sm-6">
                                            	<c:forEach var="item" items="${operationTypes }">
                                            	<div class="checkbox">
                                            		<input type="checkbox" value="${item.id} " name="operationType">${item.operationTypeName}
                                            	</div>
                                            	</c:forEach>
												
                                            </div>
                                        </div>                                              
                                        <%--真人照片 1张 --%>                                  
						                     <div class="form-group">
						                        <label class="control-label col-sm-3">上传本人照片</label>
						                            <div class="fileupload fileupload-new" data-provides="fileupload" >
						                                <div class="fileupload-new thumbnail" style="width: 200px; height: 150px;"><img src="assets/img/demoUpload.jpg" alt="" /></div> 
						                                <div class="fileupload-preview fileupload-exists thumbnail" style="max-width: 200px; max-height: 150px; line-height: 20px;"></div>
						                                
						                                    <span class="btn btn-file btn-success" style="margin:30px"><span class="fileupload-new">选择照片</span><span class="fileupload-exists">更改照片</span><input type="file" name="portr" accept="image/*"></span>
						                                    <a href="#" class="btn btn-danger fileupload-exists" data-dismiss="fileupload">移除</a>
						                                
						                            </div>
						                    </div>                                       
                                        <%--身份证照片 --%>                                      
					                    <div class="form-group">
					                        <label class="control-label col-sm-3">上传身份证正反照片</label>
					                        <div class="col-sm-3">
					                            <div class="fileupload fileupload-new" data-provides="fileupload">
					                                <div>
					                                    <span class="btn btn-file btn-success"><span class="fileupload-new">选择照片</span><span class="fileupload-exists">更改照片</span><input name="idCards" type="file" multiple="multiple" accept="image/*"></span>
					                                    <a href="#" class="btn btn-danger fileupload-exists" data-dismiss="fileupload">移除</a>
					                                </div>
					                            </div>
					                        </div>
					             <%--         <label class="control-label col-sm-1">上传身份证反面照片</label>
					                        <div class="col-sm-3">
					                            <div class="fileupload fileupload-new" data-provides="fileupload">
					                                <div class="fileupload-preview thumbnail" style="width: 200px; height: 150px;"></div>
					                                <div>
					                                    <span class="btn btn-file btn-success"><span class="fileupload-new">选择照片</span><span class="fileupload-exists">Change</span><input type="file"></span>
					                                    <a href="#" class="btn btn-danger fileupload-exists" data-dismiss="fileupload">Remove</a>
					                                </div>
					                            </div>
					                        </div>		--%> 			                        
					                    </div>  
                               
                                      
                                        <%--学历证书照片 --%>
                                 		<div class="form-group">
                                            <label for="degreeImg" class="control-label col-sm-3">学位证书与毕业证书照片</label>
					                        <div class="col-sm-3">
					                             <div class="fileupload fileupload-new" data-provides="fileupload"> 
					                          <%--       <div class="fileupload-preview thumbnail" style="width: 200px; height: 150px;"></div>--%>
					                                <div>
					                                    <span class="btn btn-file btn-success"><span class="fileupload-new">选择照片</span><span class="fileupload-exists">更改照片</span><input type="file" multiple="multiple" name="degs" accept="image/*"></span>
					                                    <a href="#" class="btn btn-danger fileupload-exists" data-dismiss="fileupload">移除</a>
					                                </div>
					                            </div>
					                        </div>
					          <%--               <label class="control-label col-sm-1">学历证书照片</label>
					                        <div class="col-sm-3">
					                            <div class="fileupload fileupload-new" data-provides="fileupload">
					                                <div class="fileupload-preview thumbnail" style="width: 200px; height: 150px;"></div>
					                                <div>
					                                    <span class="btn btn-file btn-success"><span class="fileupload-new">选择照片</span><span class="fileupload-exists">Change</span><input type="file"></span>
					                                    <a href="#" class="btn btn-danger fileupload-exists" data-dismiss="fileupload">Remove</a>
					                                </div>
					                            </div>
					                        </div>			--%>		                        
                                        </div>
                                        
                                 		<div class="form-group">
					                        <label class="control-label col-sm-3">医生从业资格证书照片</label>
					                        <div class="col-sm-3">
					                            <div class="fileupload fileupload-new" data-provides="fileupload">
					                            <%--     <div class="fileupload-preview thumbnail" style="width: 200px; height: 150px;"></div>--%>
					                                <div>
					                                    <span class="btn btn-file btn-success"><span class="fileupload-new">选择照片</span><span class="fileupload-exists">更改照片</span><input type="file" multiple="multiple" name="quas" accept="image/*"></span>
					                                    <a href="#" class="btn btn-danger fileupload-exists" data-dismiss="fileupload">移除</a>
					                                </div>
					                            </div>
					                        </div>	
                                        </div>   
                                        
                                 		<div class="form-group">
					                        <label class="control-label col-sm-3">医生执业证书照片</label>
					                        <div class="col-sm-3">
					                            <div class="fileupload fileupload-new" data-provides="fileupload">
					                            <%--     <div class="fileupload-preview thumbnail" style="width: 200px; height: 150px;"></div>--%>
					                                <div>
					                                    <span class="btn btn-file btn-success"><span class="fileupload-new">选择照片</span><span class="fileupload-exists">更改照片</span><input type="file" multiple="multiple" name="certs" accept="image/*"></span>
					                                    <a href="#" class="btn btn-danger fileupload-exists" data-dismiss="fileupload">移除</a>
					                                </div>
					                            </div>
					                        </div>	
                                        </div>  
                                        
                                 		<div class="form-group">
					                        <label class="control-label col-sm-3">医生职称证书照片</label>
					                        <div class="col-sm-3">
					                            <div class="fileupload fileupload-new" data-provides="fileupload">
					                            <%--     <div class="fileupload-preview thumbnail" style="width: 200px; height: 150px;"></div>--%>
					                                <div>
					                                    <span class="btn btn-file btn-success"><span class="fileupload-new">选择照片</span><span class="fileupload-exists">更改照片</span><input type="file" multiple="multiple" name="pros" accept="image/*"></span>
					                                    <a href="#" class="btn btn-danger fileupload-exists" data-dismiss="fileupload">移除</a>
					                                </div>
					                            </div>
					                        </div>	
                                        </div>                                                                                                                                                              
                                        <button type="submit" class="btn btn-info" id="sm">提交</button>

                                    </form>
                            	</div>
                            </div>

<script src="assets/js/bootstrap-fileupload.js"></script>


<script type="text/javascript" >
$("#sm").click(function() {
	var name = $("#name").val();
	var phone = $("#phone").val();
	var iden = $("#identification").val();
	var labels = $("input:checkbox[name='operationType']:checked")
	var reg_phone = /(^[0-9]{3,4}-[0-9]{3,8}$)|(^[0-9]{3,8}$)|(^\([0-9]{3,4}\)[0-9]{3,8}$)|(^0{0,1}1[0-9]{10}$)/;
	var reg_name = /^[\u4e00-\u9fa5]{2,4}$/;
	var reg_iden =  /^[1-9]\d{5}(19\d{2}|[2-9]\d{3})((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])(\d{4}|\d{3}X)$/i;
	
	var portr = $("input[type=file][name=portr]");
	var idCards = $("input[type=file][name=idCards]");
	var degs = $("input[type=file][name=degs]");
	var quas = $("input[type=file][name=quas]");
	var certs = $("input[type=file][name=certs]");
	var pros = $("input[type=file][name=pros]");

	if(name == ""||(!reg_name.test(name) )) {
		alert("未输入姓名或输入格式不符合要求")
		return false;	
	}	
	if(phone == ""||(!reg_phone.test(phone) )) {
		alert("未输入电话号码或输入格式不符合要求")
		return false;	
	}	
	if(iden == ""||(!reg_iden.test(iden) )) {
		alert("未输入身份证号码或输入格式不符合要求")
		return false;	
	}	
	if(labels.length == 0) {
		alert("请至少给该医生一个标签，否则他将无法接任何单子！");
		return false;
	}
	if(portr.val() == "") {
		alert("请上传本人照片");
		return false;
	}
	if(idCards.val() == "") {
		alert("请上传身份证照片");
		return false;
	}
	if(degs.val() == "") {
		alert("请上传学历学位证照片");
		return false;
	}
	if(quas.val() == "") {
		alert("请上传医师资格证照片");
		return false;
	}
	if(certs.val() == "") {
		alert("请上传执业证照片");
		return false;
	}
	if(pros.val() == "") {
		alert("请上传职称证照片");
		return false;
	}
	
});
</script>
  </body>
</html>